package cvut.swe.semestralka.sesame;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class Timetable {
	
	private Station station;
	
	private Map<Integer, List<Depart>> departs;
	
	private String timetableURI;
	
	private Line line;
	
	private String smer;
	
	public Timetable(){
		departs = new TreeMap<Integer, List<Depart>>();
	}

	
	
	public String getSmer() {
		return smer;
	}



	public void setSmer(String smer) {
		this.smer = smer;
	}



	public Line getLine() {
		return line;
	}



	public void setLine(Line line) {
		this.line = line;
	}



	public String getTimetableURI() {
		return timetableURI;
	}



	public void setTimetableURI(String timetableURI) {
		this.timetableURI = timetableURI;
	}



	public Station getStation() {
		return station;
	}

	public void setStation(Station station) {
		this.station = station;
	}

	public Map<Integer, List<Depart>> getDeparts() {
		return departs;
	}
	
	void addDepart(Integer hour, Depart depart){
		boolean containsKey = departs.containsKey(hour);
		if(containsKey){
			departs.get(hour).add(depart);
			Collections.sort(departs.get(hour));
		}else{
			List<Depart> dep = new ArrayList<Depart>();
			dep.add(depart);
			departs.put(hour, dep);
		}
	}
	
	
}
